<!-- author: 汪孟苹 -->
<link rel="stylesheet" href="page/followup/css/common/common.css">
<link rel="stylesheet" href="page/followup/css/outPatient/outPatient.css">
<link rel="stylesheet" href="page/followup/css/outPatient/outPatientPrint.css" media="print"/>  
<link rel="stylesheet" href="page/followup/css/outPatient/outPatientRuyuanPrint.css" />
<style>
	#lisAndPacs {
		width: 34px;
		height: 84px;
		text-align: center;
		background-color: #409EFF;
		color: #fff;
		font-size: 14px;
		font-weight: bold;
		position: fixed;
		top: 350px;
		right: 27px;
		box-sizing: border-box;
		padding: 10px;
		line-height: 1.2;
		box-shadow: 0 0 5px #aaa;
		border-radius: 3px 0 0 3px;
		cursor: pointer;
	}
	._spBlock {
		width: 400px;
		height: calc(100% - 92px);
		position: fixed;
		bottom: 0;
		right: -400px;
		z-index: 9;
		background-color: #fff;
		box-shadow: 0 0 5px #aaa;
		transition: right .2s ease-out;
	}
	._show {
		right: 0;
	}
	.data-header {
		padding: 8px 15px;
		box-sizing: border-box;
		border-bottom: 1px solid #ccc;
	}
	._content {
		width: 100%;
		height: calc(100% - 41px);
		box-sizing: border-box;
		padding: 15px;
	}
	._key {
		width: 90px;
		display: inline-block;
		font-size: 14px;
		text-align: right;
		color: #333;
		margin-right: 10px;
	}
	._scrollView {
		width: 100%;
		height: calc(100% - 130px);
		overflow: auto;
	}
	._scrollView .none {
		width: 100%;
		display: block;
		font-size: 14px;
		color: #ccc;
		line-height: 100px;
		text-align: center;
	}
	._row {
		padding: 10px 0;
		border-bottom: 1px dashed #ccc;
		margin-bottom: 10px;
	}
	._row:first-child {
		padding-top: 0;
	}
	._row ._date {
		color: #333;
		font-size: 14px;
	}
	._row ._resultp {
		font-size: 14px;
		color: #333;
		word-break: break-all;
	}
	._row span {
		font-weight: bold;
	}
	.maxHeight {
		height: calc(100% - 70px);
	}
</style>

<body>
	<!-- 2020年10月30日 关联患者至其他队列      start  -->
		<div class="patient_relation_" style="display: none;">
			<div class="patient_relation_content_">
				<div class="patient_relation_content_title">
					<p>关联其他队列患者</p>
					<span class="close"><i class="fa fa-times"></i></span>
				</div>
				<div class="patient_relation_content_left">
					<p class="patient_relation_content_left_title">请选择需关联的队列</p>
					<div class="appendBox"></div>
				</div>
				<!-- <div class="patient_relation_content_right">
					<p class="patient_relation_content_right_title">② 请选择随访方式</p>
				</div> -->
				<div class="patient_relation_footer">
					<span class="btn" id="_patient_next_info">
						提交
						<i class="fa fa-arrow-right"></i>
					</span>
				</div>
			</div>
		</div>
	<!-- 2020年10月30日 关联患者至其他队列      end  -->

	<div class="row ws-clinic">
	  	<div id="taskBabycard" class="col-sm-2 col-md-2 ws-clinic-left"></div>
	  	<div class="col-sm-10 col-md-10 ws-clinic-right">
			<div class="row showBox">
				<div class="col-sm-1 col-md-1">
					<div class="arrow arrow-left">
						<i class="fa fa-chevron-left"></i>
					</div>
				</div>
				<div class="col-sm-10 col-md-10">
					<div id="showContainer" class="show-container"></div>
				</div>
				<div class="col-sm-1 col-md-1">
					<div class="arrow arrow-right">
						<i class="fa fa-chevron-right"></i>
					</div>
				</div>
			</div>
	  	</div>
	  	<div class="col-sm-12 col-md-12 ws-clinic-con">
			<!-- 问卷大标题 -->
			<div id="followUpTit" class="ws-clinic-formTit"></div>
			<!-- 问卷 -->
			<div id ="followUpInfo"></div>
			<!-- 悬浮nav （锚点） -->
			<div id="anchorMenu" class="anchor-menu"></div>
			<!-- lis pacs emr（按钮）  -->
			<div id="lisAndPacs">对接数据</div>
			<!-- lis pacs emr vue 挂载点 -->
			<div id="lisAndPacsRoot">
				<div :class="['_spBlock', { '_show': show }]">
					<el-page-header class="data-header" @back="show = false" content="对接数据"></el-page-header>
					<div class="_content">
						<div style="margin-bottom: 10px;">
							<span class="_key">请选择系统：</span>
							<el-select v-model="system" placeholder="请选择系统" size="mini">
								<el-option label="LIS" value="1" />
								<el-option label="PACS" value="2" />
								<el-option label="EMR" value="3" />
							</el-select>
						</div>
						<div style="margin-bottom: 10px;" v-if="system != 3">
							<span class="_key">开始日期：</span>
							<el-date-picker
								style="width: 178px;"
								v-model="start_time"
								type="date" size="mini"
								value-format="yyyy-MM-dd"
								placeholder="选择日期">
							</el-date-picker>
						</div>
						<div  v-if="system != 3" style="padding-bottom: 10px;">
							<span class="_key">结束日期：</span>
							<el-date-picker
								style="width: 178px;"
								v-model="end_time"
								type="date" size="mini"
								value-format="yyyy-MM-dd"
								placeholder="选择日期">
							</el-date-picker>
						</div>
						<el-button type="primary" size="mini" @click="handleSearch" style="margin-left: 10px;">查询</el-button>
						<hr style="margin: 10px 0;" />
						
						<div :class="['_scrollView', system == 3 ? 'maxHeight' : '' ]" >
							<span class="none" v-if="showResultType == 0">请选择需要查询的系统和时间范围</span>
							<div class="lisContent" v-else-if="showResultType == 1">
								<div class="_row" v-for="(item, index) in LisList" :key="index">
									<div class="_date"><span>时间：</span>{{ item.date1 }}</div>
									<div class="_pat" v-if="item.pat0 != ''"><span>患者来源：</span>{{ item.pat0 == 1 ? '门诊' : '住院' }}</div>
									<div class="_resultp" v-if="item.patCheck1"><span>血气分析：</span>{{ getResult(item.patCheck1) }}</div>
									<div class="_resultp" v-if="item.patCheck2"><span>肝肾功能心肌酶：</span>{{ getResult(item.patCheck2) }}</div>
									<div class="_resultp" v-if="item.patCheck3"><span>pct：</span>{{ getResult(item.patCheck3) }}</div>
									<div class="_resultp" v-if="item.patCheck4"><span>crp：</span>{{ getResult(item.patCheck4) }}</div>
									<div class="_resultp" v-if="item.patCheck5"><span>NT-proBNP：</span>{{ getResult(item.patCheck5) }}</div>
									<div class="_resultp" v-if="item.patCheck6"><span>体液免疫：</span>{{ getResult(item.patCheck6) }}</div>
									<div class="_resultp" v-if="item.patCheck7"><span>细胞免疫：</span>{{ getResult(item.patCheck7) }}</div>
									<div class="_resultp" v-if="item.patCheck8"><span>维生素：</span>{{ getResult(item.patCheck8) }}</div>
									<div class="_resultp" v-if="item.patCheck9"><span>微量元素：</span>{{ getResult(item.patCheck9) }}</div>
									<div class="_resultp" v-if="item.patCheck10"><span>铁蛋白：</span>{{ getResult(item.patCheck10) }}</div>
									<div class="_resultp" v-if="item.patCheck11"><span>骨钙素：</span>{{ getResult(item.patCheck11) }}</div>
									<div class="_resultp" v-if="item.patCheck12"><span>维生素D3：</span>{{ getResult(item.patCheck12) }}</div>
									<div class="_resultp" v-if="item.patCheck13"><span>甲状腺功能：</span>{{ getResult(item.patCheck13) }}</div>
									<div class="_resultp" v-if="item.patCheck14"><span>血常规：</span>{{ getResult(item.patCheck14) }}</div>
									<div class="_resultp" v-if="item.patCheck15"><span>凝血功能：</span>{{ getResult(item.patCheck15) }}</div>
									<div class="_resultp" v-if="item.patCheck16"><span>溶血全套及血型：</span>{{ getResult(item.patCheck16) }}</div>
									<div class="_resultp" v-if="item.patCheck17"><span>凝血因子：</span>{{ getResult(item.patCheck17) }}</div>
									<div class="_resultp" v-if="item.patCheck18"><span>脑脊液常规生化：</span>{{ getResult(item.patCheck18) }}</div>
									<div class="_resultp" v-if="item.patCheck19"><span>外周血细胞形态分析：</span>{{ getResult(item.patCheck19) }}</div>
									<div class="_resultp" v-if="item.patCheck20"><span>食物过敏原：</span>{{ getResult(item.patCheck20) }}</div>
									<div class="_resultp" v-if="item.patCheck21"><span>结缔组织病全套：</span>{{ getResult(item.patCheck21) }}</div>
									<div class="_resultp" v-if="item.patCheck22"><span>血沉：</span>{{ getResult(item.patCheck22) }}</div>
									<div class="_resultp" v-if="item.patCheck23"><span>血小板相关抗体：</span>{{ getResult(item.patCheck23) }}</div>
									<div class="_resultp" v-if="item.patCheck24"><span>血生化：</span>{{ getResult(item.patCheck24) }}</div>
									<div class="_resultp" v-if="item.patCheck25"><span>尿常规：</span>{{ getResult(item.patCheck25) }}</div>
									<div class="_resultp" v-if="item.patCheck26"><span>粪常规数：</span>{{ getResult(item.patCheck26) }}</div>
									<div class="_resultp" v-if="item.patCheck27"><span>骨密度数据：</span>{{ getResult(item.patCheck27) }}</div>
									<div class="_resultp" v-if="item.patCheck28"><span>出院诊断：</span>{{ getResult(item.patCheck28) }}</div>
									<div class="_resultp" v-if="item.patCheck29"><span>住院情况：</span>{{ getResult(item.patCheck29) }}</div>
									<div class="_resultp" v-if="item.patCheck30"><span>出院情况：</span>{{ getResult(item.patCheck30) }}</div>
								</div>
							</div>
							<div class="pacsContent" v-else-if="showResultType == 2">
								<div class="_row" v-for="(item, index) in PacsList" :key="index">
									<div class="_date"><span>时间：</span>{{ item.date1 }}</div>
									<div class="_pat" v-if="item.pat0 != ''"><span>患者来源：</span>{{ item.pat0 == 1 ? '门诊' : '住院' }}</div>
									<div class="_resultp" v-if="item.patReport1"><span>头颅核磁报告：</span>{{ getResult(item.patReport1) }}</div>
									<div class="_resultp" v-if="item.patReportURL1"><span>头颅核磁报告地址：</span><a :href="item.patReportURL1" target="_blank">{{ item.patReportURL1 }}</a></div>

									<div class="_resultp" v-if="item.patReport2"><span>超声报告：</span>{{ getResult(item.patReport2) }}</div>
									<div class="_resultp" v-if="item.patReportURL2"><span>超声报告地址：</span><a :href="item.patReportURL2" target="_blank">{{ item.patReportURL2 }}</a></div>

									<div class="_resultp" v-if="item.patReport3"><span>X线报告：</span>{{ getResult(item.patReport3) }}</div>
									<div class="_resultp" v-if="item.patReportURL3"><span>X线报告地址：</span><a :href="item.patReportURL3" target="_blank">{{ item.patReportURL3 }}</a></div>

									<div class="_resultp" v-if="item.patReport4"><span>骨髓象报告：</span>{{ getResult(item.patReport4) }}</div>
									<div class="_resultp" v-if="item.patReportURL4"><span>骨髓象报告地址：</span><a :href="item.patReportURL4" target="_blank">{{ item.patReportURL4 }}</a></div>

									<div class="_resultp" v-if="item.patReport5"><span>腹部B超：</span>{{ getResult(item.patReport5) }}</div>
									<div class="_resultp" v-if="item.patReportURL5"><span>腹部B超地址：</span><a :href="item.patReportURL5" target="_blank">{{ item.patReportURL5 }}</a></div>

									<div class="_resultp" v-if="item.patReport6"><span>脑电图：</span>{{ getResult(item.patReport6) }}</div>
									<div class="_resultp" v-if="item.patReportURL6"><span>脑电图地址：</span><a :href="item.patReportURL6" target="_blank">{{ item.patReportURL6 }}</a></div>

									<div class="_resultp" v-if="item.patReport7"><span>头颅CT：</span>{{ getResult(item.patReport7) }}</div>
									<div class="_resultp" v-if="item.patReportURL7"><span>头颅CT地址：</span><a :href="item.patReportURL7" target="_blank">{{ item.patReportURL7 }}</a></div>

									<div class="_resultp" v-if="item.patReport8"><span>头颅MRI报告：</span>{{ getResult(item.patReport8) }}</div>
									<div class="_resultp" v-if="item.patReportURL8"><span>头颅MRI地址：</span><a :href="item.patReportURL8" target="_blank">{{ item.patReportURL8 }}</a></div>

									<div class="_resultp" v-if="item.patReport9"><span>颅脑B超：</span>{{ getResult(item.patReport9) }}</div>
									<div class="_resultp" v-if="item.patReportURL9"><span>颅脑B超地址：</span><a :href="item.patReportURL9" target="_blank">{{ item.patReportURL9 }}</a></div>

									<div class="_resultp" v-if="item.patReport10"><span>新生儿血气：</span>{{ getResult(item.patReport10) }}</div>
									<div class="_resultp" v-if="item.patReportURL10"><span>新生儿血气地址：</span><a :href="item.patReportURL10" target="_blank">{{ item.patReportURL10 }}</a></div>

									<div class="_resultp" v-if="item.patReport11"><span>眼底筛查报告：</span>{{ getResult(item.patReport11) }}</div>
									<div class="_resultp" v-if="item.patReportURL11"><span>眼底筛查报告地址：</span><a :href="item.patReportURL11" target="_blank">{{ item.patReportURL11 }}</a></div>

									<div class="_resultp" v-if="item.patReport17"><span>心脏超声：</span>{{ getResult(item.patReport17) }}</div>
									<div class="_resultp" v-if="item.patReportURL17"><span>心脏超声报告地址：</span><a :href="item.patReportURL17" target="_blank">{{ item.patReportURL17 }}</a></div>

								</div>
							</div>
							<div class="emrContent" v-else0if="showResultType == 3">
								<div class="_row" v-for="(item, index) in EmrList" :key="index">
									<div class="_date" v-if="item.emr100"><span>就诊时间：</span>{{ item.emr100 }}</div>
									<div class="_resultp" v-if="item.emr101"><span>就诊科室：</span>{{ item.emr101 }}</div>
									<div class="_resultp" v-if="item.emr102"><span>诊断结果：</span>{{ item.emr102 }}</div>
									<div class="_resultp" v-if="item.emr103"><span>处置方法：</span>{{ item.emr103 }}</div>
								</div>
							</div>

						</div>
						
					</div>
				</div>
			</div>
			<!-- vue 挂载点 -->
			<div id="root" style="display: none;">

				<!-- 标记预约 -->
				<el-dialog title="选择要预约的日期" :visible.sync="dialog.show" width="35%">

					<span>{{ dialog.title }}</span>
					<el-date-picker
						v-model="dialog.date"
						type="date" size="small"
						:picker-options="dialog.pickerOptions"
						placeholder="选择日期" />
					<el-radio-group v-model="dialog.noon" size="small" style="margin-left: 10px;">
						<el-radio-button label="1">上午</el-radio-button>
						<el-radio-button label="2">下午</el-radio-button>
					</el-radio-group>

					<span slot="footer" class="dialog-footer">
						<el-button size="small" @click="dialog.show = false">取消</el-button>
						<el-button size="small" :loading="dialog.loading" type="primary" @click="handleSubmit">提交</el-button>
					</span>
				</el-dialog>

				<!-- 预约详情 -->
				<el-dialog title="预约详情" :visible.sync="detail.show" width="50%">
					<el-table :data="detail.data" v-loading="detail.loading" element-loading-text="加载中...">
						<el-table-column
							prop="appointTime"
							align="center"
							label="预约日期" />
						<el-table-column
							align="center"
							label="预约类型">
							<template slot-scope="scope">
								{{ scope.row.appointType == '1' ? '医生标记预约' : '患者标记预约' }}
							</template>
						</el-table-column>
						<el-table-column
							align="center"
							label="预约状态">
							<template slot-scope="scope">
								{{ getStatus(scope.row.status) }}
							</template>
						</el-table-column>
						<el-table-column
							prop="createTime"
							align="center"
							label="创建时间" />
						<el-table-column
							prop="creator"
							align="center"
							label="创建人">
							{{ creator }}
						</el-table-column>
					</el-table>
					<div style="margin-top: 15px; text-align: right;">
						<el-pagination
							background
							@current-change="handleChangePage"
							:page-size="detail.pageSize"
							layout="total, prev, pager, next"
							:total="detail.total" />
					</div>
				</el-dialog>

			</div>
	  	</div>
	</div>

	<!-- 打印问卷 -->
	<div class="print-wrap" style="display:none;">
		<div id="printContent" class="print-content clearfix">
		</div>
	</div>



<!-- Cannot read property 'opera' of undefined错误问题是juqery版本兼容问题
解决方法：加入迁移辅助插件jquery-migrate-1.0.0.js可解决版本问题 -->
<script src="page/followup/app/outPatient/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript">
require(['jquery','fu/app/outPatient/outPatient'],function($,$outPatient){
	$outPatient.init();  
});
</script>
<script type="text/javascript">
/**
 * 对接 lis pasc emr
 */
require([
	'jquery', 
	'bbcare'
], function ($, $bb) {
	var URL = $bb.baseUrl("followup")

	var vm = new Vue({
		el: '#lisAndPacsRoot',
		data: function () {
			return {
				show: false,
				showResultType: 0,
				system: '',
				start_time: '',
				end_time: '',
				LisList: [],
				PacsList: [],
				EmrList: []
			}
		},
		methods: {
			getResult: function (text) {
				return text.replace(/&amp;/g, ' ').replace(/amp;/g, ' ');
			},
			/**
			 * 显示这个块
			 */
			showBlock: function () {
				this.show = true;
			},
			/**
			 * 查询系统内容
			 */
			handleSearch: function () {
				if (this.system == '') return this.$message.error('您未选择需要查询的系统');
				if (this.system != 3) {
					if (this.start_time == '' || this.end_time == '') return this.$message.error('请您选择完整时间后查询');
					var start = new Date(this.start_time).getTime();
					var end = new Date(this.end_time).getTime();
					if (start > end) return this.$message.error('您的开始时间大于结束时间')
				}
				var params = $('.content-main').data().params;
				var that = this;
				switch(this.system) {
					case '1':	// Lis
						$bb.ajax({
							url: URL + 'followup/webapi/his/getpatientlis?followup_id=' + params.patientId + '&start_time=' + this.start_time + '&end_time=' + this.end_time,
							success: function (res) {
								if (!res.success) return that.$message.error(res.msg);
								that.showResultType = 1;
								that.LisList = res.data;
							}
						})
					break
					case '2':	// Pacs
						$bb.ajax({
							url: URL + 'followup/webapi/his/getpatientpacs?followup_id=' + params.patientId + '&start_time=' + this.start_time + '&end_time=' + this.end_time,
							success: function (res) {
								if (!res.success) return that.$message.error(res.msg);
								that.showResultType = 2;
								that.PacsList = res.data;
							}
						})
					break
					case '3':	// Emr
					$bb.ajax({
							url: URL + 'followup/webapi/his/getpatientemr?followup_id=' + params.patientId,
							success: function (res) {
								if (!res.success) return that.$message.error(res.msg);
								that.showResultType = 3;
								that.EmrList = res.data;
							}
						})
					break
				}
			}
		}
	});

	$('#lisAndPacs').click(function () {
		vm.showBlock();
	})

})
</script>
</body>
